<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>JsTetris - javascript tetris game</title>
    <style type="text/css">
    html, body { height: 100%; margin: 0; padding: 0; }
    body {
        background: #E1D4C0;
    }
    body, table {
        font: 11px tahoma;
        color: #826C55;
    }

    /*** tetris 168,308 ***/

    #tetris {
        position: relative;
        width: 300px;
        height: 310px;
        border: 1px solid #BAA68E;
        background: #ffffff;
        margin: 0 auto;
    }
    
    /*** left ***/

    #tetris .left {
        background: #F5EDE3;
        position: absolute;
        width: 130px;
        height: 100%;
        left: 0px;
        top: 0px;
    }
    #tetris .left h1 {
        font-size: 11px;
        text-align: center;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    #tetris .left h1 a {
        color: #3366CC;
        text-decoration: none;
    }
    #tetris .left h1 a:hover {
        color: #FF6600;
        text-decoration: none;
    }
    
    /* menu */
    
    #tetris .left .menu {
        text-align: center;
    }
    #tetris .left input {
        font: 10px tahoma;
        color: #333333;
        text-transform: uppercase;
        background: #EAE0D1;
    }
    #tetris .left .menu input {
        width: 90px;
    }

    /* keyboard */

    #tetris .left .keyboard {
        position: absolute;
        top: 163px;
        left: 32px;
        width: 85px;
        height: 55px;
        overflow: visible;
        display: none;
    }
    #tetris .left .keyboard input {
        font: 11px tahoma;
        width: 25px;
        height: 25px;
        padding-bottom: 2px;
        text-transform: none;
    }
    * html #tetris .left .keyboard input {
        padding-left: 1px;
    }
    #tetris .left .keyboard .up {
        position: absolute;
        left: 30px;
        top: 0px;
        width: 30px;
        height: 30px;
    }
    #tetris .left .keyboard .up input {
        font: 15px tahoma;
        padding-top: 3px;
    }
    #tetris .left .keyboard .down {
        position: absolute;
        left: 30px;
        top: 30px;
        width: 30px;
        height: 30px;
    }
    #tetris .left .keyboard .down input {
        font: 14px tahoma;
    }
    #tetris .left .keyboard .left {
        position: absolute;
        left: 0px;
        top: 30px;
        width: 30px;
        height: 30px;
    }
    #tetris .left .keyboard .right {
        position: absolute;
        left: 60px;
        top: 30px;
        width: 30px;
        height: 30px;
    }

    /* game over */

    #tetris-gameover {
        position: absolute;
        width: 100%;
        top: 50%;
        text-align: center;
        font-weight: bold;
        display: none;
    }

    /* next puzzle */
    #tetris-nextpuzzle {
        position: absolute;
        top: 49%;
        left: 35%;
        background: #ffffff;
        overflow: visible;
        display: none;
    }

    /* stats */

    #tetris .left .stats {
        position: absolute;
        left: 35px;
        bottom: 10px;
    }
    #tetris .stats td { padding-bottom: 1px; }
    
    #tetris .stats .level { text-align: right; padding-right: 10px; }
    #tetris-stats-level { font-weight: bold; }

    #tetris .stats .time { text-align: right; padding-right: 10px; }
    #tetris-stats-time { font-weight: bold; }
    
    #tetris .stats .apm { text-align: right; padding-right: 10px; }
    #tetris-stats-apm { font-weight: bold; }

    #tetris .stats .lines { text-align: right; padding-right: 10px; }
    #tetris-stats-lines { font-weight: bold; }

    #tetris .stats .score { text-align: right; padding-right: 10px; }
    #tetris-stats-score { font-weight: bold; }

    /*** area ***/

    #tetris-area {
        background: #FFFFFF;
        position: absolute;
        width: 168px;
        height: 308px;
        left: 131px;
        top: 1px;
        overflow: hidden;
    }
    #tetris .block0,
    #tetris .block1,
    #tetris .block2,
    #tetris .block3,
    #tetris .block4,
    #tetris .block5,
    #tetris .block6 {
        position: absolute;
        width: 13px;
        height: 13px;
        border: 0.5px solid #ffffff;
        /* with margin 0.5px there were problems with offsetLeft and offsetTop */
    }
    #tetris .block0,
    #tetris .block1 {
        background: #6699FF;
    }
    #tetris .block2,
    #tetris .block3 {
        background: #FF6600;
    }
    #tetris .block4 {
        background: #FFAC1C;
    }
    #tetris .block5 {
        background: #BAA68E;
    }
    #tetris .block6 {
        background: #FF0000;
    }

    /*** window ***/

    #tetris .window {
        background: #EFE8DE;
        position: absolute;
        width: 168px;
        height: 308px;
        left: 131px;
        top: 1px;
        z-index: 5;
        display: none;
    }
    #tetris .window .top {
        position: relative;
        background: #EAE0D1;
        color: #666666;
        font: 10px tahoma;
        letter-spacing: +1px;
        height: 20px;
        line-height: 20px;
        vertical-align: middle;
        border-bottom: 1px solid #ffffff;
        text-indent: 10px;
    }
    #tetris .window .top .close {
        position: absolute;
        background: #EAE0D1;
        font: 11px verdana;
        font-weight: bold;
        right: 0px;
        top: 0px;
        height: 20px;
        line-height: 19px;
        text-indent: 7px;
        width: 21px;
        border-left: 1px solid #ffffff;
        cursor: pointer;
    }
    #tetris .window .top .close:hover {
        background: #EFE8DE;
    }
    #tetris .window .content {
        font: 10px tahoma;
        margin: 10px;
    }
    #tetris .window .content table {
        font: 10px tahoma;
    }

    </style>
    <script type="text/javascript" src="Tetris.js"></script>
</head>
<body>

    <table cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td valign="middle">

    <div id="tetris">
        <div class="left">
            <h1><a href="http://gosu.pl/dhtml/JsTetris.html">JsTetris 1.1.0</a></h1>
            <div class="menu">
                <div><input type="button" value="New Game" id="tetris-menu-start" /></div>
                <div><input type="button" value="Reset" id="tetris-menu-reset" /></div>
                <div><input type="button" value="Help" id="tetris-menu-help" /></div>
                <div><input type="button" value="Highscores" id="tetris-menu-highscores" /></div>
            </div>
            <div class="keyboard">
                <div class="up"><input type="button" value="^" id="tetris-keyboard-up" /></div>
                <div class="down"><input type="button" value="v" id="tetris-keyboard-down" /></div>
                <div class="left"><input type="button" value="&lt;" id="tetris-keyboard-left" /></div>
                <div class="right"><input type="button" value="&gt;" id="tetris-keyboard-right" /></div>
            </div>
            <div id="tetris-nextpuzzle"></div>
            <div id="tetris-gameover">Game Over</div>
            <div class="stats">
                <table cellspacing="0" cellpadding="0">
                <tr>
                    <td class="level">Level:</td>
                    <td><span id="tetris-stats-level">1</span></td>
                </tr>
                <tr>
                    <td class="score">Score:</td>
                    <td><span id="tetris-stats-score">0</span></td>
                </tr>
                <tr>
                    <td class="lines">Lines:</td>
                    <td><span id="tetris-stats-lines">0</span></td>
                </tr>
                <tr>
                    <td class="apm">APM:</td>
                    <td><span id="tetris-stats-apm">0</span></td>
                </tr>
                <tr>
                    <td class="time">Time:</td>
                    <td><span id="tetris-stats-time">0</span></td>
                </tr>
                
                </table>
            </div>
        </div>
        <div id="tetris-area"></div>
        <div id="tetris-help" class="window">
            <div class="top">
                Help <span id="tetris-help-close" class="close">x</span>
            </div>
            <div class="content">
                <b>Controllers:</b> <br />
                up - rotate <br />
                down - move down <br />
                left - move left <br />
                right - move right <br />
                space - fall to the bottom <br />
                n - new game <br />
                r - reset <br />
                <br />
                <b>Rules:</b> <br />
                1) Puzzle speed = 80+700/level miliseconds, the smaller value the faster puzzle falls <br />
                2) If puzzles created in current level >= 10+level*2 then increase level <br />
                3) After puzzle falling score is increased by 1000*level*linesRemoved <br />
                4) Each "down" action increases score by 5+level (pressing space counts as multiple down actions)
            </div>
        </div>
        <div id="tetris-highscores" class="window">
            <div class="top">
                Highscores <span id="tetris-highscores-close" class="close">x</span>
            </div>
            <div class="content">
                <div id="tetris-highscores-content"></div>
                <br />
                Note: these scores are kept in cookies, they are only visible to your computer, other players that visit this page see their own scores.
            </div>
        </div>
    </div>
    
    </td></tr></table>

    <script type="text/javascript">
    var tetris = new Tetris();
    tetris.unit = 14;
    tetris.areaX = 12;
    tetris.areaY = 22;
    /*
      TODO:
      - highscores, adding to cookie
      - setting own keys, keep in cookie
    */
    </script>

</body>
</html>